#!/bin/bash
# * @package deepin-refresh
# * @author Lyvnee
# * @version 0.2
# * @license MIT
# * @link http://lyvnee.com

echo "==========开始安装=========="
dirname="/usr/share/deepin/dde-file-manager/oem-menuextensions"
if [ ! -d  $dirname ];then
  echo "正在创建插件路径..."
  sudo mkdir -p $dirname
else
  echo "插件路径已存在！"
fi

echo "安装所需依赖..."
sudo apt install dde-file-manager-menu-oem xautomation -y

echo "开始创建refresh.desktop文件..."
cd $dirname
sudo sh -c 'cat >refresh.desktop<< EOF
[Desktop Entry]
Type=Application
Name=refresh
Name[zh_CN]=刷新
Icon=view-refresh
#Exec=xte "key F5"
Exec=xte "keydown Multi_key" "key F5" "keyup Multi_key"
X-DFM-MenuTypes=EmptyArea
EOF'

echo "==========安装完成=========="
echo "请重启文件管理器，点击右键查看。"